//
//  LHXTabBarViewController.m
//  Etwo
//
//  Created by 林浩翔 on 16/6/17.
//  Copyright © 2016年 林浩翔. All rights reserved.
//

#import "LHXTabBarViewController.h"
#import "LHXMainViewController.h"
#import "LHXCutImageViewController.h"
#import "LHXWritingViewController.h"
#import "LHXMainBtnItem.h"
#import "LHXBtnItem.h"




@interface LHXTabBarViewController ()

@end

@implementation LHXTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.tabBar.hidden = YES;
    
    //监听通知
    NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
    [center addObserver:self selector:@selector(comeBackFristVC) name:@"LHXcomeBackFrist" object:nil];
    [center addObserver:self selector:@selector(changeMainView) name:@"LHXMainView" object:nil];
    [center addObserver:self selector:@selector(changeCutView) name:@"LHXCutView" object:nil];
    [center addObserver:self selector:@selector(writingView) name:@"LHXWritingView" object:nil];
    
    
    LHXMainViewController *mainChosseVC = [[LHXMainViewController alloc]init];
    [self addChildViewController:mainChosseVC];
    
    LHXCutImageViewController *cutImageVC = [[LHXCutImageViewController alloc]init];
    [self addChildViewController:cutImageVC];
    
    LHXWritingViewController *writingVC = [[LHXWritingViewController alloc]init];
    [self addChildViewController:writingVC];
    
    UIViewController *VC3 = [[UIViewController alloc]init];
    VC3.view.backgroundColor = [UIColor greenColor];
    [self addChildViewController:VC3];
    

}


#pragma mark --接受通知跳转界面
- (void)changeMainView{
    self.selectedIndex = 0;
}
- (void)changeCutView{
    self.selectedIndex = 1;
}
- (void)writingView{
    self.selectedIndex = 2;
}


- (void)comeBackFristVC{
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)dealloc{
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
